import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * @author ckf
 * @create 2018 05 15 16:13
 * @desc
 **/
public class homework1 {

    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("D:\\homework1.txt");
        FileInputStream fis = new FileInputStream("D:\\homework1.txt");
        try {
            String words = "hello word!!";
            byte[] str = words.getBytes();
            fos.write(str);
            int data = 0;
            while ((data = fis.read()) != -1) {
                System.out.print((char) data);
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            fos.close();
            fis.close();
        }

    }

}

